home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacHack 1996
/
MacHack 1996.toast
/
Hacks
/
Hacks ’92
/
Text Capture FKEY
/
Num_to_hex.c
< prev
next >
Wrap
Text File
|
1995-09-10
|
376b
|
18 lines
void Num_to_hex( long num, StringPtr hex, short numbytes );
void Num_to_hex( long num, StringPtr hex, short numbytes )
{
short curbyte;
long lastnyb;
hex[0] = 2 * numbytes;
for (curbyte = hex[0]; curbyte > 0; --curbyte)
{
lastnyb = num & 0x0000000FL;
if (lastnyb < 10)
hex[curbyte] = lastnyb + '0';
else
hex[curbyte] = lastnyb - 10 + 'A';
num >>= 4;
}
}